<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
    <script src="../../../scripts/jquery.min.js"></script>
    <script src="../../../scripts/miniui/miniui.js"></script>
    <link href="../../../scripts/miniui/themes/default/miniui.css" rel="stylesheet">
    <link href="../../../scripts/miniui/themes/icons.css" rel="stylesheet">
    <link href="../../../scripts/miniui/themes/pure/skin.css" rel="stylesheet">
    <script src="../../../scripts/core.js"></script>

</head>
<body>
<div class="mini-toolbar" style="padding:2px;border-bottom:0;">
    <table style="width:100%;">
        <tr>
            <td style="width:100%;">
                <a class="mini-button" iconCls="icon-add" onclick="submitForm()" plain="true">改变系统时间</a>
                <a class="mini-button" iconCls="icon-edit" onclick="reset()" plain="true">恢复系统时间</a>
            </td>
        </tr>
    </table>
</div>
<div id="form1">
    <table>
        <tr>
            <td><label for="username$text">目标时间：</label></td>
            <td>
                <input class="mini-datepicker" format="yyyy-MM-dd H:mm:ss" name="time" nullValue="null"
                       showClearButton="false" showOkButton="true" showTime="true" style="width:200px;"
                       timeFormat="H:mm:ss"/>

            </td>
        </tr>
    </table>
</div>


<script type="text/javascript">
    var auth = GetParams()
    console.log(auth)
    mini.parse();

    function submitForm() {

        var form = new mini.Form("#form1");
        //提交数据
        var data = form.getData();
        var json = mini.encode(data);
        $.ajax({
            url: "/sys/setTime",
            headers: {"userId": auth.userId, "token": auth.token},
            data: json,
            type: "post",
            contentType: 'application/json',
            success: function (text) {
                var resp = mini.decode(text)

                if (resp.code == 200) {
                    mini.alert("修改成功");
                } else {
                    mini.alert("修改成功")
                }
            }
        });
    }

    function reset() {
        $.ajax({
            url: "/sys/resetSysTime",
            headers: {"userId": auth.userId, "token": auth.token},
            type: "post",
            contentType: 'application/json',
            success: function (text) {
                var resp = mini.decode(text)

                if (resp.code == 200) {
                    mini.alert("修改成功");
                } else {
                    mini.alert("修改成功")
                }
            }
        });
    }

</script>


</body>
</html>